<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('jy_weishop/member')->checklogin('','','','',true);
	$return['list']=array();
	$tuilogid=intval($_RQ['tuilogid']);
	$_SESSION['tuilogid']=$tuilogid;
	$return['params']=array('tuilogid'=>$tuilogid,'ordersn'=>$_RQ['ordersn']?:'');
	$return['tuilog']=pdo_get('jy_newcar_tuilog',array('id'=>$tuilogid,'uniacid'=>$_SESSION['uniacid']));
	$return['post']['pay_type']=$pay_type;
	set_html('title','推广奖励');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid'],'type'=>1);
	if($_RQ['ordersn']){
		$params['ordersn']=$_RQ['ordersn'];
	}
	if($_RQ['tuilogid']){
		$params['tuilogid']=$_RQ['tuilogid'];
	}
	if(!$_RQ['ordersn'] && !$_RQ['tuilogid']){
		exi('请从推广组或订单进入！','error');
	}
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'orderby'=>'createtime asc',
	);
	$list=$this->get_list('commission',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['statustitle']=$this->commission_status[$item['status']];	
		$item['createtime']=date('Y-m-d H:i',$item['createtime']);
	}
	exi($list);
}
?>